<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        const obj = {
            name: 'laoxi',
            age: 18
        }

        /* function foo(obj) {
            const name = obj.name;
            const age = obj.age
            console.log(name, age);
        }
        foo(obj); */
        // 函数
        function foo({
            name,
            age
        }) {
            console.log(name, age);
        }
        // 函数调用
        foo(obj);
        foo({
            name: 'tom',
            age: 108
        });
    </script>
</body>

</html>